<template>
	<view>

		<u-modal :show="show" :title="title" :showCancelButton="true" :showConfirmButton="true" title="举报原因"
			@confirm="toConfirm" width="550rpx" @cancel="toCancel" :getContainer="false">
			<view class="chooseBox">
				<!-- 		<u-radio-group v-model="radiovalue1" placement="column" @change="groupChange">
					<u-radio :customStyle="{marginBottom: '30rpx'}" v-for="(item, index) in radiolist1" :key="index"
						:label="item.name" :name="item.name" @change="radioChange">
					</u-radio>
				</u-radio-group> -->

				<u-checkbox-group v-model="checkboxValue1" placement="column" @change="checkboxChange">
					<u-checkbox :customStyle="{marginBottom: '30rpx'}" v-for="(item, index) in list" :key="index"
						:label="item.name" :name="item.name">
					</u-checkbox>
				</u-checkbox-group>
			</view>
		</u-modal>
	</view>
</template>

<script>
	import {
		dictionary
	} from "@/api/subletOfShop.js"
	import {
		xxjc
	} from '@/api/api.js'
	export default {
		data() {
			return {
				show: false,
				title: '标题',
				list: [],
				// u-radio-group的v-model绑定的值如果设置为某个radio的name，就会被默认选中
				checkedBoxs: [],
				cont: [],
				checkboxValue1: []
			}

		},
		props: {
			types: {
				type: String,
				default: ''
			},
			linkId: {
				type: Number | Number,
				default: ''
			}
		},
		created() {
			this.getDictionary()
		},
		mounted() {

		},
		methods: {
			open() {
				this.show = true;

			},
			checkboxChange(e) {
				this.cont = e;
			},
			radioChange(n) {

			},
			toConfirm() {
				let params = {
					type: this.types,
					linkId: this.linkId,
					content: this.cont.join(',')
				}
				xxjc(params).then(res => {
					if (res.code == 200) {
						this.show = false;
						this.$util.Tips({
							title: '举报成功'
						})
					}
				})
			},
			toCancel() {

				this.show = false;
			},
			//获取户型字典列表
			async getDictionary() {
				try {
					const {
						data
					} = await dictionary({
						gids: 33
					});
					this.list = data['33']
					

				} catch (e) {
					//TODO handle the exception
				}
			},
		}
	}
</script>

<style lang="scss">
	::v-deep .u-modal__content {
		padding: 30rpx 70rpx !important;
	}

	.chooseBox {
		width: 100%;
		padding: 20rpx 60rpx;
	}
</style>